<%-- 
    Created on : 2019
    Author     : 黄忠
--%>

<%@page import="friendManager.FriendBean"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>个人信息管理系统->删除联系人</title>
    <link rel="stylesheet" href="../CSS/infor.css">
</head>
<body bgcolor="CCCFFF">
<br><br>
    <%
        ArrayList friendslist=(ArrayList)session.getAttribute("friendslist");
        if(friendslist==null||friendslist.size()==0){
    %>
    <div align="center">
        <h1>您还没有任何联系人！</h1>
    </div>
    <%
    }else{
    %>
<table cellspacing="0" cellpadding="0" style="width: 99%;" align="center">
    <tr>
        <th>姓名</th>
        <th>电话</th>
        <th>邮箱</th>
        <th>工作单位</th>
        <th>家庭住址</th>
        <th>QQ</th>
        <th>操作</th>
    </tr>
</table>
<table id="pageMain" cellspacing="0" cellpadding="0" style="width: 99%;" align="center">
    <%
        for(int i=friendslist.size()-1;i>=0;i--){
            FriendBean ff=(FriendBean)friendslist.get(i);
    %>
    <tr class="hoverTr">
        <td><%=ff.getName()%></td>
        <td><%=ff.getPhone()%></td>
        <td><%=ff.getEmail()%></td>
        <td><%=ff.getWorkPlace()%></td>
        <td><%=ff.getPlace()%></td>
        <td><%=ff.getQQ()%></td>
        <td><a href="#" onclick="deleteCall(<%="'"+ff.getName()+"'"%>)">删除</a></td>
    </tr>
    <%
            }
        }
    %>
</table>
</body>
<%@include file="../page.jsp" %>
</html>
<script>
    function deleteCall(userName) {
        var result=confirm('您确定要删除'+userName+'吗？');
        if(result){
            window.open("http://localhost:8080/DeleteFriendServlet?Name="+userName,"main");
        }
    }
</script>

